<?php
class News_NMenuController extends XPHP_Controller
{
	public function viewAction()
	{
	}
	#[Authorize(roles = 'Administrator')]
	public function createAction()
	{
		$model = new Areas_News_Models_News();
        //Lấy ra danh sách tin tức
        $newsList = $model->getNews();
        //Lấy ra mảng đưa vào hộp select
        $options = array();
        foreach ($newsList as $news) {
            $options[$news->id] = $news->title;
        }
        //Assign sang view
        $this->view->newsOptions = $options;
        
		return $this->view();
	}
	#[Authorize(roles = 'Administrator')]
	public function editAction()
	{
		$model = new Areas_News_Models_News();
        //Lấy ra danh sách tin tức
        $newsList = $model->getNews();
        //Lấy ra mảng đưa vào hộp select
        $options = array();
        foreach ($newsList as $news) {
            $options[$news->id] = $news->title;
        }
        //Assign sang view
        $this->view->newsOptions = $options;
        
        //Value
        $this->view->value = $this->params[0];
		return $this->view();
	}
}